﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DataAccess.ObjectTwo
{
   public class D_ChangePassword
    {
        SqlConnection con;
        DataTable tb = new DataTable();
        ConnectionToDataBase ex = new ConnectionToDataBase();
        MD5 fx = new MD5();
        public bool ChangePassword(String NewPass,String oldPass,String User)
        {
            String NewPass1;
            NewPass1 = fx.getMD5(NewPass);
            String OldPass1;
            OldPass1 = fx.getMD5(oldPass);
            SqlParameter[] sqlParameters = new SqlParameter[3];
            sqlParameters[0] = new SqlParameter("@v_CCode", SqlDbType.VarChar);
            sqlParameters[0].Value = User;
            sqlParameters[1] = new SqlParameter("@OldPass", SqlDbType.VarChar);
            sqlParameters[1].Value = OldPass1;
            sqlParameters[2] = new SqlParameter("@Pass", SqlDbType.VarChar);
            sqlParameters[2].Value = NewPass1;            
            return ex.executeUpdateQuery("ChangePasswordAD", sqlParameters);
               
              
        }
    }
}
